﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models.windows.restricted {
    import net.wooga.pets.views.windows.*;
    import __AS3__.vec.*;

    public class AbstractWindowsModel {

        private var _windowQue:Vector.<IWindowView>;
        private var _currentView:IWindowView;

        private static var _incrementalUID:int;

        public function AbstractWindowsModel(){
            this._windowQue = new Vector.<IWindowView>();
            super();
        }
        public function appendNewWindowToQue(_arg1:IWindowView):void{
            this.addIdToView(_arg1);
            this._windowQue.push(_arg1);
        }
        public function removeWindowViewFromQue(_arg1:IWindowView):Boolean{
            var _local2:int = this._windowQue.indexOf(_arg1);
            if (_local2 != -1){
                this._windowQue.splice(_local2, 1);
            };
            if (!this.hasNextWindow){
                this._currentView = null;
            };
            return (!((_local2 == -1)));
        }
        public function existsWindowWithSameKey(_arg1:String):Boolean{
            var _local2:IWindowView;
            for each (_local2 in this._windowQue) {
                if (_local2.options.textValues.body == _arg1){
                    return (true);
                };
            };
            return (false);
        }
        private function addIdToView(_arg1:IWindowView):void{
            _arg1.id = this.uniqueId;
        }
        public function get uniqueId():int{
            return (_incrementalUID++);
        }
        public function get nextWindow():IWindowView{
            this._currentView = this._windowQue[0];
            return (this._currentView);
        }
        public function get hasNextWindow():Boolean{
            return ((this._windowQue.length > 0));
        }
        public function getQue():Vector.<IWindowView>{
            return (this._windowQue);
        }
        public function get currentView():IWindowView{
            return (this._currentView);
        }
        public function viewIsSetToAutoClose(_arg1:IWindowView):Boolean{
            return (!((_arg1.options.autoClose == null)));
        }
        public function get hasNoCurrentViewSet():Boolean{
            return ((this._currentView == null));
        }

    }
}//package net.wooga.pets.models.windows.restricted 
